<?php
/**
 * XiteCode text area widget
 *
 * Use:<br />
 * <code>
 * {TextArea id="id" [label="label"] [cols="30"] [rows="15"]}
 * </code>
 */

function smarty_function_TextArea($params, &$Smarty)
{
  $label    = '';
  $required = '';
  $cols     = 30;
  $rows     = 15;

  if (empty($params['id'])) {
    return '{TextField} You must supply an id.';
  }

  if (!empty($params['cols'])) {
    $cols = $params['cols'];
  }

  if (!empty($params['rows'])) {
    $rows = $params['rows'];
  }

  if (!empty($params['required'])) {
    $required = ' class="required"';
  }

  if (!empty($params['label'])) {
    $label = '<label for="'.$params['id'].'"'.$required.'>'.$params['label'].'</label>';
  }

  return $label.'<textarea id="'.$params['id'].'" name="'.$params['id'].'" cols="'.$cols.'" rows="'.$rows.'"></textarea><br />';
}

?>
